package cn.youwan.market;

import java.util.ArrayList;
import java.util.List;

import cn.youwan.market.adapter.TuijianAdapter;
import cn.youwan.market.entity.AppListBean;
import cn.youwan.market.entity.PromotionListbean.Appbean;
import cn.youwan.market.message.YouwanMessage;
import android.os.AsyncTask;
import android.os.Bundle;
import android.app.Activity;
import android.util.Log;
import android.view.Menu;
import android.widget.ListView;
/*
 * 榜单
 * */
public class RankingActivity extends Activity {

	private ListView mRankList;
	public List<Appbean> apps = new ArrayList<Appbean>();
	protected AppListBean bean;
	private TuijianAdapter mAdapter;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.ranking);
		
		mRankList = (ListView) findViewById(R.id.list_ranking);
		getMoreGameRank();
	}

	public void getMoreGameRank() {
		new AsyncTask<Void, Void, Void>() {

			protected void onPreExecute() {
			};

			@Override
			protected Void doInBackground(Void... params) {
				YouwanMessage message = new YouwanMessage(RankingActivity.this);
				bean = message.getAppsList("http://gd.7pingmi.com.cn/game/server/?m=gameInfo",1);
				return null;
			}

			@Override
			protected void onPostExecute(Void result) {
				super.onPostExecute(result);
				apps=bean.getBeans();
				Log.i("load APPS", apps.toString());
				mAdapter=new TuijianAdapter(RankingActivity.this,apps,mRankList);
				mRankList.setAdapter(mAdapter);
			}
		}.execute();
	}

}
